package com.fish.anne.dao.ibatis;

import java.util.List;

import com.fish.anne.dao.OrderDao;
import com.fish.anne.model.Order;
import com.fish.anne.webapp.formbean.OrderSearch;

public class OrderDaoiBatis extends GenericDaoiBatis<Order, Long> implements OrderDao {

	public OrderDaoiBatis() {
		super(Order.class);
	}

	@SuppressWarnings("unchecked")
	public List<Order> find(OrderSearch orderSearch){
		return getSqlMapClientTemplate().queryForList( "findOrderBySearch", orderSearch);
	}

	public Long getCountBySearch(OrderSearch orderSearch){
		return (Long)getSqlMapClientTemplate().queryForObject( "getOrderCountBySearch", orderSearch);
	}

	public void updateStatus(Order order) {
		 getSqlMapClientTemplate().update( "updateOrderStatus", order);		
	}
	public List<Order> getOrderByMemberId(Long memberId) {
		List<Order> orders =  (List<Order>) getSqlMapClientTemplate().queryForList("getOrderByMemberId", memberId);
    	return orders;
	}
	public void deleteOrder(Long orderId) {
		getSqlMapClientTemplate().delete("deleteOrder", orderId);
    	
	}
	
	
}
